<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>活动相册系统</title>
    <script>
        // 页面加载时设置默认用户信息
        (function() {
            // 设置默认的活动相册用户信息
            if (!localStorage.getItem('albumCurrentUser')) {
                localStorage.setItem('albumCurrentUser', JSON.stringify({
                    name: '活动相册管理员',
                    role: '活动相册管理员'
                }));
                localStorage.setItem('albumIsLoggedIn', 'true');
            }
        })();
    </script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #333;
            min-height: 100vh;
        }

        .container {
            display: flex;
            min-height: 100vh;
        }

        /* 左侧侧边栏 */
        .sidebar {
            width: 280px;
            background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 50%, #3b82f6 100%);
            color: white;
            padding: 0;
            box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
            position: fixed;
            height: 100vh;
            overflow-y: auto;
        }

        .sidebar-header {
            padding: 30px 20px;
            background: rgba(255, 255, 255, 0.1);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            margin-bottom: 20px;
            text-align: center;
        }

        .sidebar-title {
            font-size: 22px;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .nav-menu {
            list-style: none;
            padding: 0 15px;
        }

        .nav-item {
            margin-bottom: 8px;
        }

        .nav-link {
            display: flex;
            align-items: center;
            padding: 15px 20px;
            color: white;
            text-decoration: none;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            border-radius: 12px;
            border-left: 4px solid transparent;
        }

        .nav-link:hover, .nav-link.active {
            background: rgba(255, 255, 255, 0.1);
            border-left-color: #60a5fa;
            transform: translateX(5px);
        }

        .nav-icon {
            margin-right: 15px;
            font-size: 18px;
        }

        /* 右侧主内容区域 */
        .main-content {
            flex: 1;
            margin-left: 280px;
            padding: 30px;
            background: rgba(255, 255, 255, 0.95);
        }

        .content-header {
            background: white;
            padding: 25px 30px;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .header-left h1 {
            font-size: 28px;
            color: #1e3a8a;
            margin-bottom: 8px;
        }

        .breadcrumb {
            color: #6b7280;
            font-size: 14px;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-avatar {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            color: white;
        }

        .user-details {
            text-align: right;
        }

        .user-name {
            font-weight: bold;
            color: #1e3a8a;
            margin-bottom: 4px;
        }

        .user-role {
            color: #6b7280;
            font-size: 14px;
        }

        .btn-logout {
            background: #ef4444;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-logout:hover {
            background: #dc2626;
        }

        /* 功能模块样式 */
        .function-module {
            background: white;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
            overflow: hidden;
        }

        .module-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px 30px;
            font-size: 18px;
            font-weight: bold;
        }

        .module-content {
            padding: 30px;
        }

        /* 数据表格样式 */
        .data-table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .data-table th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px;
            text-align: left;
            font-weight: 600;
        }

        .data-table td {
            padding: 15px;
            border-bottom: 1px solid #e5e7eb;
        }

        .data-table tr:hover {
            background: #f8fafc;
        }

        .status-badge {
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }

        .status-active {
            background: #dcfce7;
            color: #166534;
        }

        .status-inactive {
            background: #fef2f2;
            color: #dc2626;
        }

        .action-buttons {
            display: flex;
            gap: 8px;
        }

        .btn-action {
            padding: 6px 12px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.3s ease;
        }

        .btn-action-view {
            background: #3b82f6;
            color: white;
        }

        .btn-action-view:hover {
            background: #2563eb;
        }

        .btn-action-edit {
            background: #f59e0b;
            color: white;
        }

        .btn-action-edit:hover {
            background: #d97706;
        }

        .btn-action-delete {
            background: #ef4444;
            color: white;
        }

        .btn-action-delete:hover {
            background: #dc2626;
        }

        .btn-action-select {
            background: #10b981;
            color: white;
        }

        .btn-action-select:hover {
            background: #059669;
        }

        /* 表单样式 */
        .form-container {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 25px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .form-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
        }

        .form-input {
            padding: 12px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-textarea {
            padding: 12px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
            resize: vertical;
            min-height: 100px;
        }

        .form-textarea:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-actions {
            display: flex;
            gap: 15px;
            justify-content: flex-end;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: #6b7280;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-secondary:hover {
            background: #4b5563;
        }

        /* 搜索区域样式 */
        .search-container {
            background: white;
            border-radius: 15px;
            padding: 20px 30px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .search-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            align-items: end;
        }

        .search-group {
            display: flex;
            flex-direction: column;
        }

        .search-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
        }

        .search-input {
            padding: 10px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .search-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .search-actions {
            display: flex;
            gap: 10px;
        }

        .btn-search {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-search-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .btn-search-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-search-secondary {
            background: #6b7280;
            color: white;
        }

        .btn-search-secondary:hover {
            background: #4b5563;
        }

        /* 照片网格样式 */
        .photo-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }

        .photo-card {
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }

        .photo-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }

        .photo-image {
            width: 100%;
            height: 200px;
            object-fit: cover;
        }

        .photo-info {
            padding: 15px;
        }

        .photo-title {
            font-weight: 600;
            color: #1e3a8a;
            margin-bottom: 8px;
        }

        .photo-meta {
            color: #6b7280;
            font-size: 14px;
            margin-bottom: 10px;
        }

        .photo-actions {
            display: flex;
            gap: 8px;
        }

        /* 文件上传样式 */
        .file-upload {
            border: 2px dashed #d1d5db;
            border-radius: 8px;
            padding: 40px;
            text-align: center;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .file-upload:hover {
            border-color: #3b82f6;
            background: #f8fafc;
        }

        .file-upload.dragover {
            border-color: #3b82f6;
            background: #eff6ff;
        }

        .upload-icon {
            font-size: 48px;
            color: #6b7280;
            margin-bottom: 15px;
        }

        .upload-text {
            color: #6b7280;
            margin-bottom: 10px;
        }

        .upload-hint {
            color: #9ca3af;
            font-size: 14px;
        }

        /* 表格响应式 */
        .table-container {
            overflow-x: auto;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 100%;
                position: relative;
                height: auto;
            }
            
            .main-content {
                margin-left: 0;
            }
            
            .header-top {
                flex-direction: column;
                gap: 20px;
                text-align: center;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 左侧侧边栏 -->
        <nav class="sidebar">
            <div class="sidebar-header">
                <div class="sidebar-title">活动相册系统</div>
            </div>
            
            <ul class="nav-menu">
                <li class="nav-item">
                    <a href="#" class="nav-link active" onclick="switchFunction('filter-volunteers')">
                        <span class="nav-icon">👥</span>
                        <span class="nav-text">筛选志愿者</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="switchFunction('upload-photos')">
                        <span class="nav-icon">📸</span>
                        <span class="nav-text">上传照片</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="life-science-management.html" class="nav-link">
                        <span class="nav-icon">🏠</span>
                        <span class="nav-text">返回主页</span>
                    </a>
                </li>
            </ul>
        </nav>

        <!-- 右侧主内容区域 -->
        <main class="main-content">
            <div class="content-header">
                <div class="header-top">
                    <div class="header-left">
                        <h1>活动相册</h1>
                        <div class="breadcrumb">生命科学馆管理 > 活动相册</div>
                    </div>
                    <div class="user-info">
                        <div class="user-avatar">👤</div>
                        <div class="user-details">
                            <div class="user-name" id="current-user-name">活动相册管理员</div>
                            <div class="user-role" id="current-user-role">活动相册管理员</div>
                        </div>
                        <button class="btn-logout" onclick="logout()">退出登录</button>
                    </div>
                </div>
            </div>

            <!-- 筛选志愿者功能 -->
            <div id="filter-volunteers-content" class="content-section">
                <div class="function-module">
                    <div class="module-header">筛选志愿者</div>
                    <div class="module-content">
                        <div class="search-container">
                            <div class="search-grid">
                                <div class="search-group">
                                    <label class="search-label">志愿者姓名</label>
                                    <input type="text" class="search-input" id="volunteer-name-filter" placeholder="输入志愿者姓名">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">服务类型</label>
                                    <select class="search-input" id="service-type-filter">
                                        <option value="">全部类型</option>
                                        <option value="讲解服务">讲解服务</option>
                                        <option value="活动协助">活动协助</option>
                                        <option value="秩序维护">秩序维护</option>
                                        <option value="资料整理">资料整理</option>
                                        <option value="摄影记录">摄影记录</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">服务状态</label>
                                    <select class="search-input" id="service-status-filter">
                                        <option value="">全部状态</option>
                                        <option value="active">活跃</option>
                                        <option value="inactive">不活跃</option>
                                        <option value="available">可服务</option>
                                        <option value="busy">忙碌中</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">服务时长</label>
                                    <select class="search-input" id="service-hours-filter">
                                        <option value="">全部时长</option>
                                        <option value="0-50">0-50小时</option>
                                        <option value="51-100">51-100小时</option>
                                        <option value="101-200">101-200小时</option>
                                        <option value="200+">200小时以上</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">&nbsp;</label>
                                    <div class="search-actions">
                                        <button type="button" class="btn-search btn-search-primary" onclick="filterVolunteers()">筛选</button>
                                        <button type="button" class="btn-search btn-search-secondary" onclick="clearVolunteerFilter()">清除</button>
                                        <button type="button" class="btn-search btn-search-primary" onclick="selectAllVolunteers()">全选</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="table-container">
                            <table class="data-table">
                                <thead>
                                    <tr>
                                        <th><input type="checkbox" id="select-all" onclick="toggleSelectAll()"></th>
                                        <th>志愿者ID</th>
                                        <th>姓名</th>
                                        <th>电话</th>
                                        <th>邮箱</th>
                                        <th>服务类型</th>
                                        <th>服务时长</th>
                                        <th>加入日期</th>
                                        <th>状态</th>
                                        <th>评分</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="volunteer-table-body">
                                    <tr>
                                        <td><input type="checkbox" name="volunteer-select" value="V001"></td>
                                        <td>V001</td>
                                        <td>王小明</td>
                                        <td>13700137000</td>
                                        <td>wangxiaoming@example.com</td>
                                        <td>讲解服务</td>
                                        <td>200小时</td>
                                        <td>2023-01-01</td>
                                        <td><span class="status-badge status-active">活跃</span></td>
                                        <td>4.8</td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewVolunteer('V001')">查看</button>
                                            <button class="btn-action btn-action-select" onclick="selectVolunteer('V001')">选择</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox" name="volunteer-select" value="V002"></td>
                                        <td>V002</td>
                                        <td>李华</td>
                                        <td>13800238000</td>
                                        <td>lihua@example.com</td>
                                        <td>活动协助</td>
                                        <td>150小时</td>
                                        <td>2023-05-10</td>
                                        <td><span class="status-badge status-active">活跃</span></td>
                                        <td>4.6</td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewVolunteer('V002')">查看</button>
                                            <button class="btn-action btn-action-select" onclick="selectVolunteer('V002')">选择</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox" name="volunteer-select" value="V003"></td>
                                        <td>V003</td>
                                        <td>张美丽</td>
                                        <td>13900339000</td>
                                        <td>zhangmeili@example.com</td>
                                        <td>摄影记录</td>
                                        <td>80小时</td>
                                        <td>2023-08-15</td>
                                        <td><span class="status-badge status-active">活跃</span></td>
                                        <td>4.9</td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewVolunteer('V003')">查看</button>
                                            <button class="btn-action btn-action-select" onclick="selectVolunteer('V003')">选择</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td><input type="checkbox" name="volunteer-select" value="V004"></td>
                                        <td>V004</td>
                                        <td>陈志强</td>
                                        <td>13600440000</td>
                                        <td>chenzhiqiang@example.com</td>
                                        <td>秩序维护</td>
                                        <td>120小时</td>
                                        <td>2023-03-20</td>
                                        <td><span class="status-badge status-inactive">不活跃</span></td>
                                        <td>4.3</td>
                                        <td class="action-buttons">
                                            <button class="btn-action btn-action-view" onclick="viewVolunteer('V004')">查看</button>
                                            <button class="btn-action btn-action-select" onclick="selectVolunteer('V004')">选择</button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 上传照片功能 -->
            <div id="upload-photos-content" class="content-section" style="display: none;">
                <div class="function-module">
                    <div class="module-header">上传活动照片</div>
                    <div class="module-content">
                        <div class="form-container">
                            <form id="photo-upload-form">
                                <div class="form-grid">
                                    <div class="form-group">
                                        <label class="form-label">活动名称 *</label>
                                        <input type="text" class="form-input" name="activityName" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">活动日期 *</label>
                                        <input type="date" class="form-input" name="activityDate" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">活动类型 *</label>
                                        <select class="form-input" name="activityType" required>
                                            <option value="">请选择活动类型</option>
                                            <option value="科普讲座">科普讲座</option>
                                            <option value="展览活动">展览活动</option>
                                            <option value="互动体验">互动体验</option>
                                            <option value="志愿者培训">志愿者培训</option>
                                            <option value="其他">其他</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">摄影师</label>
                                        <select class="form-input" name="photographer">
                                            <option value="">请选择摄影师</option>
                                            <option value="张美丽">张美丽</option>
                                            <option value="王小明">王小明</option>
                                            <option value="李华">李华</option>
                                            <option value="其他">其他</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="form-label">活动描述</label>
                                    <textarea class="form-textarea" name="activityDescription" placeholder="请描述活动的具体内容和亮点..."></textarea>
                                </div>
                                <div class="form-group">
                                    <label class="form-label">上传照片 *</label>
                                    <div class="file-upload" onclick="document.getElementById('photo-files').click()">
                                        <div class="upload-icon">📸</div>
                                        <div class="upload-text">点击选择照片或拖拽照片到此处</div>
                                        <div class="upload-hint">支持 JPG、PNG、GIF 格式，单个文件不超过 10MB</div>
                                    </div>
                                    <input type="file" id="photo-files" name="photos" multiple accept="image/*" style="display: none;" onchange="handleFileSelect(this)">
                                </div>
                                <div class="form-actions">
                                    <button type="button" class="btn-secondary" onclick="resetPhotoForm()">重置</button>
                                    <button type="submit" class="btn-primary">上传照片</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="function-module">
                    <div class="module-header">已上传照片</div>
                    <div class="module-content">
                        <div class="search-container">
                            <div class="search-grid">
                                <div class="search-group">
                                    <label class="search-label">活动名称</label>
                                    <input type="text" class="search-input" id="photo-activity-filter" placeholder="输入活动名称">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">活动类型</label>
                                    <select class="search-input" id="photo-type-filter">
                                        <option value="">全部类型</option>
                                        <option value="科普讲座">科普讲座</option>
                                        <option value="展览活动">展览活动</option>
                                        <option value="互动体验">互动体验</option>
                                        <option value="志愿者培训">志愿者培训</option>
                                        <option value="其他">其他</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">上传日期</label>
                                    <input type="date" class="search-input" id="photo-date-filter">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">&nbsp;</label>
                                    <div class="search-actions">
                                        <button type="button" class="btn-search btn-search-primary" onclick="searchPhotos()">搜索</button>
                                        <button type="button" class="btn-search btn-search-secondary" onclick="clearPhotoSearch()">清除</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="photo-grid" id="photo-grid">
                            <div class="photo-card">
                                <img src="https://via.placeholder.com/300x200/667eea/ffffff?text=科普讲座" alt="科普讲座照片" class="photo-image">
                                <div class="photo-info">
                                    <div class="photo-title">2024年生命科学科普讲座</div>
                                    <div class="photo-meta">科普讲座 • 2024-01-15 • 张美丽</div>
                                    <div class="photo-actions">
                                        <button class="btn-action btn-action-view" onclick="viewPhoto('P001')">查看</button>
                                        <button class="btn-action btn-action-edit" onclick="editPhoto('P001')">编辑</button>
                                        <button class="btn-action btn-action-delete" onclick="deletePhoto('P001')">删除</button>
                                    </div>
                                </div>
                            </div>
                            <div class="photo-card">
                                <img src="https://via.placeholder.com/300x200/764ba2/ffffff?text=展览活动" alt="展览活动照片" class="photo-image">
                                <div class="photo-info">
                                    <div class="photo-title">生物多样性展览活动</div>
                                    <div class="photo-meta">展览活动 • 2024-01-10 • 王小明</div>
                                    <div class="photo-actions">
                                        <button class="btn-action btn-action-view" onclick="viewPhoto('P002')">查看</button>
                                        <button class="btn-action btn-action-edit" onclick="editPhoto('P002')">编辑</button>
                                        <button class="btn-action btn-action-delete" onclick="deletePhoto('P002')">删除</button>
                                    </div>
                                </div>
                            </div>
                            <div class="photo-card">
                                <img src="https://via.placeholder.com/300x200/10b981/ffffff?text=互动体验" alt="互动体验照片" class="photo-image">
                                <div class="photo-info">
                                    <div class="photo-title">VR科技互动体验</div>
                                    <div class="photo-meta">互动体验 • 2024-01-08 • 李华</div>
                                    <div class="photo-actions">
                                        <button class="btn-action btn-action-view" onclick="viewPhoto('P003')">查看</button>
                                        <button class="btn-action btn-action-edit" onclick="editPhoto('P003')">编辑</button>
                                        <button class="btn-action btn-action-delete" onclick="deletePhoto('P003')">删除</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        // 页面加载时设置用户信息
        document.addEventListener('DOMContentLoaded', function() {
            const currentUser = localStorage.getItem('albumCurrentUser');
            if (currentUser) {
                const user = JSON.parse(currentUser);
                document.getElementById('current-user-name').textContent = user.name || '活动相册管理员';
                document.getElementById('current-user-role').textContent = user.role || '活动相册管理员';
            }
        });

        // 功能切换
        function switchFunction(functionName) {
            // 移除所有活动状态
            document.querySelectorAll('.nav-link').forEach(link => {
                link.classList.remove('active');
            });
            
            // 添加活动状态到当前点击的链接
            event.target.closest('.nav-link').classList.add('active');
            
            // 隐藏所有内容
            const allContent = document.querySelectorAll('.content-section');
            allContent.forEach(content => {
                content.style.display = 'none';
            });

            // 显示对应内容
            const targetContent = document.getElementById(functionName + '-content');
            if (targetContent) {
                targetContent.style.display = 'block';
            }
        }

        // 筛选志愿者相关函数
        function filterVolunteers() {
            const name = document.getElementById('volunteer-name-filter').value;
            const type = document.getElementById('service-type-filter').value;
            const status = document.getElementById('service-status-filter').value;
            const hours = document.getElementById('service-hours-filter').value;
            alert(`筛选志愿者: 姓名: ${name}, 类型: ${type}, 状态: ${status}, 时长: ${hours}`);
        }

        function clearVolunteerFilter() {
            document.getElementById('volunteer-name-filter').value = '';
            document.getElementById('service-type-filter').value = '';
            document.getElementById('service-status-filter').value = '';
            document.getElementById('service-hours-filter').value = '';
        }

        function selectAllVolunteers() {
            const checkboxes = document.querySelectorAll('input[name="volunteer-select"]');
            checkboxes.forEach(checkbox => {
                checkbox.checked = true;
            });
            document.getElementById('select-all').checked = true;
        }

        function toggleSelectAll() {
            const selectAllCheckbox = document.getElementById('select-all');
            const checkboxes = document.querySelectorAll('input[name="volunteer-select"]');
            checkboxes.forEach(checkbox => {
                checkbox.checked = selectAllCheckbox.checked;
            });
        }

        function viewVolunteer(id) {
            alert(`查看志愿者详情 ID: ${id}`);
        }

        function selectVolunteer(id) {
            const checkbox = document.querySelector(`input[value="${id}"]`);
            checkbox.checked = !checkbox.checked;
        }

        // 上传照片相关函数
        document.getElementById('photo-upload-form').addEventListener('submit', function(e) {
            e.preventDefault();
            const formData = new FormData(this);
            
            // 获取表单数据
            const photoData = {
                id: 'P' + Date.now(),
                activityName: formData.get('activityName'),
                activityDate: formData.get('activityDate'),
                activityType: formData.get('activityType'),
                photographer: formData.get('photographer'),
                activityDescription: formData.get('activityDescription')
            };

            // 这里可以添加数据验证和提交逻辑
            console.log('上传照片数据:', photoData);
            alert('照片上传成功！');
            
            // 重置表单
            this.reset();
        });

        function resetPhotoForm() {
            document.getElementById('photo-upload-form').reset();
        }

        function handleFileSelect(input) {
            const files = input.files;
            if (files.length > 0) {
                alert(`已选择 ${files.length} 张照片`);
            }
        }

        function searchPhotos() {
            const activityName = document.getElementById('photo-activity-filter').value;
            const activityType = document.getElementById('photo-type-filter').value;
            const uploadDate = document.getElementById('photo-date-filter').value;
            alert(`搜索照片: 活动名称: ${activityName}, 类型: ${activityType}, 日期: ${uploadDate}`);
        }

        function clearPhotoSearch() {
            document.getElementById('photo-activity-filter').value = '';
            document.getElementById('photo-type-filter').value = '';
            document.getElementById('photo-date-filter').value = '';
        }

        function viewPhoto(id) {
            alert(`查看照片详情 ID: ${id}`);
        }

        function editPhoto(id) {
            alert(`编辑照片 ID: ${id}`);
        }

        function deletePhoto(id) {
            if (confirm('确定要删除这张照片吗？')) {
                alert(`删除照片 ID: ${id}`);
            }
        }

        // 退出登录
        function logout() {
            localStorage.removeItem('albumIsLoggedIn');
            localStorage.removeItem('albumCurrentUser');
            window.location.href = 'life-science-management.html';
        }
    </script>
</body>
</html>
